/**
 * 
 */
package ccrClasses.layer2;

import ccrClasses.ICcr;

/**
 * @author matheus
 *
 */
public class DateTime implements ICcr{
	
	public static final String OPEN_TAG = "<DateTime>";

	public static final String CLOSE_TAG = "</DateTime>";
	
	/**
	 * @see constants of Type class
	 */
	private Type type;
	
	private ExactDateTime exactDateTime;

	public DateTime(Type type, ExactDateTime exactDateTime) {
		super();
		this.type = type;
		this.exactDateTime = exactDateTime;
	}

	public DateTime() {
		super();
	}

	/**
	 * @return the type
	 */
	public Type getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(Type type) {
		this.type = type;
	}

	/**
	 * @return the exactDateTime
	 */
	public ExactDateTime getExactDateTime() {
		return exactDateTime;
	}

	/**
	 * @param exactDateTime the exactDateTime to set
	 */
	public void setExactDateTime(ExactDateTime exactDateTime) {
		this.exactDateTime = exactDateTime;
	}

	/**
	 * @return the oPEN_TAG
	 */
	public String getOPEN_TAG() {
		return OPEN_TAG;
	}

	/**
	 * @return the cLOSE_TAG
	 */
	public String getCLOSE_TAG() {
		return CLOSE_TAG;
	}

	@Override
	public String constructCcrString() {
		String ccrDateTime = OPEN_TAG;
		
		if(type != null){
			ccrDateTime = ccrDateTime + type.constructCcrString();
		}
		
		if(exactDateTime != null){
			ccrDateTime = ccrDateTime + exactDateTime.constructCcrString();
		}
		
		ccrDateTime = ccrDateTime + CLOSE_TAG;
		return ccrDateTime;
	}
	
	
}

